//
//  BrandCell.m
//  phmall
//
//  Created by admin on 2017/11/24.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "BrandCell.h"

@implementation BrandCell
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self){
        self.contentView.backgroundColor=[UIColor whiteColor];
        
        self.cellImage=[[UIImageView alloc]init];
        self.cellImage.image=[UIImage imageNamed:@"图片"];
        [self.contentView addSubview:self.cellImage];
        
        self.name=[[UILabel alloc]init];
        self.name.text=@"YSL(新款)";
        self.name.textAlignment=NSTextAlignmentCenter;
        self.name.textColor=[UIColor colorWithHexString:@"#121212"];
        self.name.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.name];
    }
    
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    [self.cellImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).with.offset(-10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-10);
        make.height.mas_equalTo(self.cellImage.mas_width).multipliedBy(0.8);
    }];
    
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.left.offset(10);
        make.right.offset(-10);
        make.bottom.equalTo(self.cellImage.mas_top);
    }];

}
@end
